using System;
using System.Xml.Schema;
using System.Xml.Serialization;
using flickr.api.communication;

namespace flickr.api
{
	[Serializable]
	public class Groups : FlickrObject
	{
	    public Groups() : base() {}
	    public Groups(FlickrConnection connection) : base(connection){}
	    
		[XmlElement("group", Form=XmlSchemaForm.Unqualified)]
		public Group[] GroupsCollection;
	    
	    public Category browse(string categoryId)
	    {
            FlickrRequest request = CreateRequest();
            request.AddParameter(FlickrParameterType.CategoryId, categoryId);

            return Send(request).Category;
	    }
	    
	    public Group getInfo(string groupId)
	    {
            FlickrRequest request = CreateRequest();
	        request.AddParameter(FlickrParameterType.GroupId, groupId);

            return Send(request).Group;
	    }
	    
	    public Groups search(string text, int perPage, int page)
	    {
            FlickrRequest request = CreateRequest();
	        request.AddParameter(FlickrParameterType.Text, text);
	        request.AddParameter(FlickrParameterType.PerPage, perPage);
	        request.AddParameter(FlickrParameterType.Page, page);

            return Send(request).Groups;
	    }
	}

    [Serializable]
	public enum PoolPrivacy 
	{
		[XmlEnum("1")]
		Private = 1,
		[XmlEnum("2")]
		InviteOnlyPublic = 2,
		[XmlEnum("3")]
		OpenPublic = 3
	}
}
